/*模拟抽奖，打印每个奖项，顺序随机而且不重复*/
import java.util.Random;
public class choujiang {
    public static void main(String[] args){
        Random ra = new Random();
        int [] arr = {2,588,888,1000,10000};
        int [] newarr = new int[arr.length];  //存随机不重复的结果
        for(int i=0;i<arr.length;){
            int index = ra.nextInt(arr.length);  //随机下标
            int prize = arr[index];
            //不重复时放入数组
            if(!Judge(newarr,prize)){
                newarr[i] = arr[index];
                i++;
            }
        }

        //输出
        for(int j=0;j<newarr.length;j++){
            System.out.print(newarr[j]+" ");
        }
    }

    //判断随机取出的数字是否重复出现
    public static boolean Judge (int[] arr,int prize){
        for(int k = 0;k<arr.length;k++){
            if(prize==arr[k])
                return true;
        }
        return false;
    }
}
